<extend name="Public:innerbase" />
<block name="css">
<style type="text/css">
	img{
		background-color:#ace;
	}
</style>
</block>
<block name="content">
	<div class="container">
		<div class="page-header">
			<h3>{$title}</h3>
			<a class="btn btn-default btn-sm" href="{:U('Classify/index')}">
				<span class="glyphicon glyphicon-chevron-left"></span>&nbsp;返回
			</a>
			<div class="row">
				<div class="col-md-10" style="padding-top:5px;">
					<if condition="$info['id']">
					<span>分类地址</span>
					<code>{:C('wap_domain')}/wap/index/lists/classid/{$info.id}/token/{$_SESSION['token']}.html</code>
					</if>
				</div>
			</div>
		</div>
		<form class="form-horizontal" role="form" action="{:U('Classify/edit')}" method="post">
			<input type="hidden" name="id" value="{$info.id}" />
			<div class="form-group">
				<label for="keyword" class="col-sm-2 control-label">分类名称</label>
				<div class="col-sm-6">
					<input type="text" class="form-control" id="keyword" value="{$info.name}" name="name" />
					<span class="help-block">尽量简短，不要超过8个字</span>
				</div>
				
			</div>
			<div class="form-group">
				<label for="img" class="col-sm-2 control-label">分类图片</label>
				<div class="col-sm-6" >
					<input type="hidden" class="form-control" value="{$info.img}" id="img" name="img" />
					<img id="imgHolder" style="width:auto;height:auto;max-width:200px;" class="img" src="{$info.img|default='/Public/images/noneimg.jpg'}"/>
					<div class="btn-group" style="vertical-align:bottom;">
						<span class="btn btn-xs btn-primary" onclick="selectAsset('img')">
							<span class="glyphicon glyphicon-cloud-upload"></span>&nbsp;选择
						</span>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label for="info" class="col-sm-2 control-label">分类描述</label>
				<div class="col-sm-6">
					<textarea type="text" class="form-control" id="info" rows="3" name="info">{$info.info}</textarea>
				</div>
			</div>
			<div id="classify-addr" class="form-group">
				<label for="url" class="col-sm-2 control-label">外链地址</label>
				<div class="col-sm-6">
					<div class="input-group">
						<input type="text" class="form-control" id="url" value="{$info.url}" name="url" />
						<div class="input-group-btn">
							<a class="btn btn-primary" href="javascript:void(0)" onclick="selectLink('url')">选择</a>
						</div>
					</div>
				</div>
				<div class="col-sm-2" style="padding-top:5px;">
					
				</div>
			</div>
			<div class="form-group">
				<label for="sorts" class="col-sm-2 control-label">上级分类</label>
				<div class="col-sm-3">
					<select class="form-control" name="pid">
						<option value="0">顶级分类</option>
						<volist name="cates" id="vo">
						<option value="{$vo.id}" <if condition="$info['pid'] eq $vo['id']">selected</if>>{$vo.name}</option>
						</volist>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="sorts" class="col-sm-2 control-label">分类排序</label>
				<div class="col-sm-1">
					<input type="text" class="form-control" id="sorts" value="{$info.sorts|default=1}" name="sorts" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">是否显示</label>
				<div class="col-sm-10" style="padding-top:5px;">
					<label class="radio-inline">
						<input type="radio" name="status" id="status1" value="1" <if condition="!isset($info) OR ($info['status'] eq 1)">checked</if>>是
					</label>
					<label class="radio-inline">
						<input type="radio" name="status" id="status2" value="0" <if condition="isset($info) AND ($info['status'] eq 0)">checked</if>>否
					</label>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary">保存</button>
				</div>
			</div>
		</form>
	</div>
</block>
<block name="js">
<include file="Public:upload" />
<script type="text/javascript" src="{:STATICS}/js/holder.min.js"></script>
</block>